package gzhaoku.com.common.util;

import android.annotation.TargetApi;
import android.app.Activity;
import android.graphics.Color;
import android.os.Build;
import android.view.WindowManager;

import java.util.zip.CheckedOutputStream;

public class StatusBarUtil {

    public static void setTransparent(Activity act){
        if(Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT){
            return ;

        }

        transparentStatusBar(act);

    }

    @TargetApi(Build.VERSION_CODES.KITKAT)
    private static void transparentStatusBar(Activity act){
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            act.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            act.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//            act.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
//            act.getWindow().setStatusBarColor(Color.WHITE);

//            act.getWindow().setNavigationBarColor(Color.LTGRAY);

        }else{
            act.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
    }
}
